package com.shareppy.norman.core.sql.columns;

import com.shareppy.norman.core.sql.columns.fx.ColumnFx;

public class Column {
	
	protected String column;
	protected String alias;

	public Column(String column) {
		this(column, null);
	}

	public Column(String column, String alias) {
		this.column = column;
		this.alias = alias;
	}

	public ColumnFx getFx() {
		return null;
	}

	@Override
	public String toString() {
		if (alias == null) {
			return getColumn();
		}
		return getColumn().concat(" ").concat(alias);
	}

	private String getColumn() {
		ColumnFx fx = getFx();
		if (fx == null) {
			return column;
		}
		return fx.apply(column);
	}

}
